import os

s = 0
p = input()
'''
def search(p):
    global s
    dirs = []
    
    if p ==[]:
        return
    
    for i in os.listdir(p):
        print(i)
        ss = os.path.join(p,i)
        if os.path.isfile(ss) == True:
            print('huh')
            s += 1
        if os.path.isdir(ss) == True:
            dirs.append(ss)
            
    for i in dirs:
        search(i)
'''        
#压行警告

def search(p):
    global s
    dirs = []
    if p ==[]:return
    for i in os.listdir(p):
        if os.path.isfile(os.path.join(p,i)) == True:s += 1
        if os.path.isdir(os.path.join(p,i)) == True:dirs.append(os.path.join(p,i))
    for i in dirs:search(i)

        

search(p)
print(s)